<!--
*  功能描述：客户信息录入添加
 -->
<template>
  <div>
    <!-- 基本信息 -->
    <div class="jbxx">
      <el-descriptions :model="CustomerData" title="基本信息" :column="2" border>
        <el-descriptions-item label="编号：">
          <el-input v-model="CustomerData.CustId" placeholder="请输入内容"></el-input>
        </el-descriptions-item>x``
        <el-descriptions-item label="客户简称：">
          <el-input v-model="CustomerData.CustAbbreviation" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="客户名称：">
          <el-input v-model="CustomerData.CustName" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="公司地址：">
          <el-input v-model="CustomerData.CustAddress" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="邮政编码：">
          <el-input v-model="CustomerData.CustEmail" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="联系人：">
          <el-input v-model="CustomerData.CustPhones" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="公司电话：">
          <el-input v-model="CustomerData.CustPhone" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="传真号：">
          <el-input v-model="CustomerData.CustFaxNumber" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
      </el-descriptions>
    </div>
    <!-- 按钮 -->
    <div class="button">
      <el-button @click="AddCustomer">保存</el-button>
    </div>
    <!-- 甲方负责人显示 -->
    <div class="jffzr">
      <el-descriptions class="margin-top" title="甲方负责人">
        <template slot="extra">
          <el-button size="small" @click="dialogVisible = true">添加</el-button>
        </template>
      </el-descriptions>
      <template>
        <el-table :data="PersonData" border style="width: 100%">
          <el-table-column prop="PersonId" label="序号"> </el-table-column>
          <el-table-column prop="PersonNmae" label="姓名"> </el-table-column>
          <el-table-column prop="PersonZhiWu" label="职务"> </el-table-column>
          <el-table-column prop="PersonBuMen" label="部门"> </el-table-column>
          <el-table-column prop="PersonPhone" label="电话"> </el-table-column>
          <el-table-column prop="PersonEmail" label="Email"> </el-table-column>
          <el-table-column prop="PersonBeiZhu" label="备注"> </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button size="mini" @click="editPersons(scope.row)">编辑</el-button>
              <el-button size="mini" type="danger" @click="deletePersons(scope.row.PersonId)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </div>
    <!-- 扩展信息 -->
    <div class="kzxx">
      <el-descriptions :model="ExtendedData" title="扩展信息" :column="3" border>
        <!-- 第一行 -->
        <el-descriptions-item label="编号">
          <el-input v-model="ExtendedData.EdId" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="客户英文名：">
          <el-input v-model="ExtendedData.EdName" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="是否合作：">
          <el-select v-model="ExtendedData.EdISHeZuo" placeholder="请选择是否合作">
            <el-option label="是" value="shanghai"></el-option>
            <el-option label="否" value="beijing"></el-option>
          </el-select>
        </el-descriptions-item>
        <el-descriptions-item label="所在国家：">
          <el-select v-model="ExtendedData.EdCountryId1" placeholder="请选择国家" @change="showAddress2">
            <el-option v-for="item in country" :key="item.AddressId" :label="item.AddressName" :value="item.AddressId">
            </el-option>
          </el-select>
        </el-descriptions-item>
        <!-- 第二行 -->
        <el-descriptions-item label="所在省份：">
          <el-select v-model="ExtendedData.EdCountryId2" placeholder="请选择省份" @change="showAddress3">
            <el-option v-for="item in province" :key="item.AddressId" :label="item.AddressName" :value="item.AddressId">
            </el-option>
          </el-select>
        </el-descriptions-item>
        <el-descriptions-item label="所在城市：">
          <el-select v-model="ExtendedData.EdCountryId3" placeholder="请选择城市">
            <el-option v-for="item in city" :key="item.AddressId" :label="item.AddressName" :value="item.AddressId">
            </el-option>
          </el-select>
        </el-descriptions-item>

        <el-descriptions-item label="客户类型：">
          <el-select v-model="ExtendedData.EdTypeId" placeholder="请选择客户类型">
            <el-option v-for="item in ClientType" :key="item.DicId" :label="item.DicName" :value="item.DicId">
            </el-option>
          </el-select>
        </el-descriptions-item>
        <!-- 第三行 -->
        <el-descriptions-item label="所属行业：">
          <el-select v-model="ExtendedData.EdIndustryId" placeholder="请选择所属行业">
            <el-option v-for="item in industry" :key="item.DicId" :label="item.DicName" :value="item.DicId">
            </el-option>
          </el-select>
        </el-descriptions-item>

        <el-descriptions-item label="Email：">
          <el-input v-model="ExtendedData.EdEmail" placeholder="请输入内容"></el-input>
        </el-descriptions-item>

        <el-descriptions-item label="关系建立时间：">
          <el-date-picker type="date" placeholder="选择日期" v-model="ExtendedData.edCreateTime" style="width: 100%">
          </el-date-picker>
        </el-descriptions-item>
        <!-- 第四行 -->

        <el-descriptions-item label="关系部门：">
          <el-input v-model="ExtendedData.EdBuMen" placeholder="请输入内容"></el-input>
        </el-descriptions-item>

        <el-descriptions-item label="开户银行名称：">
          <el-input v-model="ExtendedData.EdBankName" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="企业代码：">
          <el-input v-model="ExtendedData.EdEnterprise" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
        <!-- 第五行 -->
        <el-descriptions-item label="开户银行账号：">
          <el-input v-model="ExtendedData.EdBankAccount" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="备注：">
          <el-input v-model="ExtendedData.EdBeiZhu" type="textarea" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
        <el-descriptions-item label="客户基本信息编号">
          <el-input v-model="ExtendedData.CustomerId" placeholder="请输入内容"></el-input>
        </el-descriptions-item>
      </el-descriptions>
      <el-button size="small" @click="AddExtended">保存</el-button>
    </div>
    <!-- 满意度调查 -->
    <div class="myddc">
      <el-descriptions class="margin-top" title="满意度调查" :size="size">
        <template slot="extra">
          <el-button size="small" @click="dialogVisibles = true">添加</el-button>
        </template>
      </el-descriptions>
      <template>
        <el-table :data="SatisfactionData" border style="width: 100%">
          <el-table-column prop="SaId" label="序号"> </el-table-column>
          <el-table-column prop="SaNeiRong" label="调查内容"> </el-table-column>
          <el-table-column prop="SaManYi" label="满意度"> </el-table-column>
          <el-table-column prop="SaTime" label="调查时间"> </el-table-column>
          <el-table-column prop="SaMethodId" label="调查方式"> </el-table-column>
          <el-table-column prop="SaBeiZhu" label="备注"> </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button size="mini" @click="editSatisfactions(scope.row)">编辑</el-button>
              <el-button size="mini" type="danger" @click="deleteSatisfactions(scope.row.SaId)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </div>
    <!-- 附件 -->
    <div class="fj">
      <el-descriptions class="margin-top" title="附件">
        <template slot="extra">
          <el-button size="small" @click="dialogVisibless=true">添加</el-button>
        </template>
      </el-descriptions>
      <template>
        <el-table :data="AccessoryData" border style="width: 100%">
          <el-table-column prop="AcsoryIdNmae" label="文件名"> </el-table-column>
          <el-table-column prop="AcsoryIdTime" label="上传时间"> </el-table-column>
          <el-table-column prop="AcsoryIdSize" label="文件大小"> </el-table-column>
          <el-table-column prop="AcsoryIdType" label="文件类型"> </el-table-column>
          <el-table-column prop="AcsoryIdUser" label="用户"> </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button size="mini" @click="editAccessorys(scope.row)">编辑</el-button>
              <el-button size="mini" type="danger" @click="deleteAccessorys(scope.row.AcsoryId)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </div>

    <!-- 添加甲方负责人 -->
    <el-dialog title="添加甲方负责人" :visible.sync="dialogVisible">
      <el-form :model="AddPerson">
        <!-- 第一行 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="序号：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson.PersonId" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="住宅电话：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson.PersonShangWuD" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>

        </el-row>
        <!-- 第二行 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="职务：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson.PersonZhiWu" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电话：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson.PersonPhone" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 第三行 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="部门：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson.PersonBuMen" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="商务传真：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson.PersonShangWuC" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 第四行 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="住宅传真：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson.PersonZhuZhaiC" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="Email：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson.PersonEmail" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 第五行 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="备注：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson.PersonBeiZhu" type="textarea"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="姓名：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson.PersonNmae" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="基本信息编号" :label-width="formLabelWidth">
              <el-input v-model="AddPerson.CustomerId" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="AddPersons">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 甲方负责人修改 -->
    <el-dialog title="编辑甲方负责人" :visible.sync="dialogVisibleEdit">
      <el-form :model="AddPerson1">
        <!-- 第一行 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="序号：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson1.PersonId" autocomplete="off" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="住宅电话：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson1.PersonShangWuD" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>

        </el-row>
        <!-- 第二行 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="职务：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson1.PersonZhiWu" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电话：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson1.PersonPhone" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 第三行 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="部门：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson1.PersonBuMen" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="商务传真：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson1.PersonShangWuC" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 第四行 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="住宅传真：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson1.PersonZhuZhaiC" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="Email：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson1.PersonEmail" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <!-- 第五行 -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="备注：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson1.PersonBeiZhu" type="textarea"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="姓名：" :label-width="formLabelWidth">
              <el-input v-model="AddPerson1.PersonNmae" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="基本信息编号" :label-width="formLabelWidth">
              <el-input v-model="AddPerson1.CustomerId" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleEdit = false">取 消</el-button>
        <el-button type="primary" @click="updatePersons">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 添加用户满意度 -->
    <el-dialog title="添加用户满意度" :visible.sync="dialogVisibles">
      <el-form :model="AddSatisfaction">
        <el-form-item label="序号：" :label-width="formLabelWidth">
          <el-input v-model="AddSatisfaction.SaId" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="调查内容：" :label-width="formLabelWidth">
          <el-input v-model="AddSatisfaction.SaNeiRong" type="textarea"></el-input>
        </el-form-item>
        <el-form-item label="客户基本信息编号" :label-width="formLabelWidth">
          <el-input v-model="AddSatisfaction.CustomerId"></el-input>
        </el-form-item>
        <el-form-item label="调查时间：" :label-width="formLabelWidth">
          <el-date-picker type="date" placeholder="选择日期" v-model="AddSatisfaction.saTime" style="width: 100%;">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="满意度：" :label-width="formLabelWidth">
          <el-select v-model="AddSatisfaction.SaManYi" placeholder="请选择调查方式">
            <el-option label="满意" value="满意"></el-option>
            <el-option label="非常满意" value="非常满意"></el-option>
            <el-option label="不满意" value="不满意"></el-option>
            <el-option label="非常不满意" value="非常不满意"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="调查方式：" :label-width="formLabelWidth">
          <el-select v-model="AddSatisfaction.SaMethodId" placeholder="请选择城市">
            <el-option label="问卷调查" value="问卷调查"></el-option>
            <el-option label="统计调查" value="统计调查"></el-option>
            <el-option label="询问调查" value="询问调查"></el-option>
            <el-option label="电话调查" value="电话调查"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="备注：" :label-width="formLabelWidth">
          <el-input v-model="AddSatisfaction.SaBeiZhu" type="textarea"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibles = false">取 消</el-button>
        <el-button type="primary" @click="AddSatisfactions">确 定</el-button>
      </div>
    </el-dialog>

    <!-- 修改用户满意度 -->
    <el-dialog title="修改用户满意度" :visible.sync="dialogVisibles1">
      <el-form :model="UpSatisfaction">
        <el-form-item label="序号：" :label-width="formLabelWidth">
          <el-input v-model="UpSatisfaction.SaId" autocomplete="off" disabled></el-input>
        </el-form-item>
        <el-form-item label="调查内容：" :label-width="formLabelWidth">
          <el-input v-model="UpSatisfaction.SaNeiRong" type="textarea"></el-input>
        </el-form-item>
        <el-form-item label="客户基本信息编号" :label-width="formLabelWidth">
          <el-input v-model="UpSatisfaction.CustomerId"></el-input>
        </el-form-item>
        <el-form-item label="调查时间：" :label-width="formLabelWidth">
          <el-date-picker type="date" placeholder="选择日期" v-model="UpSatisfaction.saTime" style="width: 100%;">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="满意度：" :label-width="formLabelWidth">
          <el-select v-model="UpSatisfaction.SaManYi" placeholder="请选择调查方式">
            <el-option label="满意" value="满意"></el-option>
            <el-option label="非常满意" value="非常满意"></el-option>
            <el-option label="不满意" value="不满意"></el-option>
            <el-option label="非常不满意" value="非常不满意"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="调查方式：" :label-width="formLabelWidth">
          <el-select v-model="UpSatisfaction.SaMethodId" placeholder="请选择城市">
            <el-option label="问卷调查" value="问卷调查"></el-option>
            <el-option label="统计调查" value="统计调查"></el-option>
            <el-option label="询问调查" value="询问调查"></el-option>
            <el-option label="电话调查" value="电话调查"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="备注：" :label-width="formLabelWidth">
          <el-input v-model="UpSatisfaction.SaBeiZhu" type="textarea"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibles1 = false">取 消</el-button>
        <el-button type="primary" @click="updateSatisfactions">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 添加附件 -->
    <el-dialog title="添加附件" :visible.sync="dialogVisibless">
      <el-form :model="AddAccessory">
        <el-form-item label="序号" :label-width="formLabelWidth">
          <el-input v-model="AddAccessory.AcsoryId" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="文件名：" :label-width="formLabelWidth">
          <el-input v-model="AddAccessory.AcsoryIdNmae" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="上传时间：" :label-width="formLabelWidth">
          <el-date-picker type="date" placeholder="选择日期" v-model="AddAccessory.AcsoryIdTime" style="width: 100%;">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="文件大小：" :label-width="formLabelWidth">
          <el-input v-model="AddAccessory.acsoryIdSize" Autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="文件类型：" :label-width="formLabelWidth">
          <el-input v-model="AddAccessory.acsoryIdType" Autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="用户：" :label-width="formLabelWidth">
          <el-input v-model="AddAccessory.acsoryIdUser" Autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="客户基本信息编号" :label-width="formLabelWidth">
          <el-input v-model="AddAccessory.customerId" Autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibless = false">取 消</el-button>
        <el-button type="primary" @click="AddAccessorys">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 修改附件 -->
    <el-dialog title="修改附件" :visible.sync="dialogVisibless2">
      <el-form :model="upAccessory">
        <el-form-item label="序号" :label-width="formLabelWidth">
          <el-input v-model="upAccessory.AcsoryId" autocomplete="off" disabled></el-input>
        </el-form-item>
        <el-form-item label="文件名：" :label-width="formLabelWidth">
          <el-input v-model="upAccessory.AcsoryIdNmae" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="上传时间：" :label-width="formLabelWidth">
          <el-date-picker type="date" placeholder="选择日期" v-model="upAccessory.AcsoryIdTime" style="width: 100%;">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="文件大小：" :label-width="formLabelWidth">
          <el-input v-model="upAccessory.AcsoryIdSize" Autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="文件类型：" :label-width="formLabelWidth">
          <el-input v-model="upAccessory.AcsoryIdType" Autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="用户：" :label-width="formLabelWidth">
          <el-input v-model="upAccessory.AcsoryIdUser" Autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibless2 = false">取 消</el-button>
        <el-button type="primary" @click="updateAccessorys">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>

export default {
  data () {
    return {
      formLabelWidth: 120,
      //客户管理
      CustomerData: {
        CustId: '',
        CustName: '',
        CustEmail: '',
        CustPhone: '',
        CustAbbreviation: '',
        CustAddress: '',
        CustPhones: '',
        CustFaxNumber: '',
      },
      //甲方负责人显示
      PersonData: [],
      //添加扩展信息
      ExtendedData: {
        EdId: '',
        EdName: '',
        EdISHeZuo: '',
        EdCountryId1: '',
        EdCountryId2: '',
        EdCountryId3: '',
        EdTypeId: '',
        EdIndustryId: '',
        EdEmail: '',
        EdCreateTime: '',
        EdBuMen: '',
        EdBankName: '',
        EdEnterprise: '',
        EdBankAccount: '',
        EdBeiZhu: '',
        CustomerId: '',
      },
      //添加甲方负责人
      AddPerson: {
        PersonId: '',
        PersonNmae: '',
        PersonZhiWu: '',
        PersonPhone: '',
        PersonBuMen: '',
        PersonShangWuD: '',
        PersonShangWuC: '',
        PersonZhuZhaiC: '',
        PersonEmail: '',
        PersonBeiZhu: '',
        CustomerId: '',
      },
      //修改甲方负责人
      AddPerson1: {
        PersonId: '',
        PersonNmae: '',
        PersonZhiWu: '',
        PersonPhone: '',
        PersonBuMen: '',
        PersonShangWuD: '',
        PersonShangWuC: '',
        PersonZhuZhaiC: '',
        PersonEmail: '',
        PersonBeiZhu: '',
      },
      dialogVisible: false,
      dialogVisibleEdit: false,
      dialogVisibles: false,
      dialogVisibless: false,
      dialogVisibles1: false,
      dialogVisibless1: false,
      dialogVisibless2: false,
      //用于显示满意度调查
      SatisfactionData: [],
      //用于显示附件
      AccessoryData: [],
      //添加客户满意度
      AddSatisfaction: {
        SsaId: '',
        SaNeiRong: '',
        SaTime: '',
        SaManYi: '',
        SaMethodId: '',
        SaBeiZhu: '',
        CustomerId: ''
      },
      //修改客户满意度
      UpSatisfaction: {
        SsaId: '',
        SaNeiRong: '',
        SaTime: '',
        SaManYi: '',
        SaMethodId: '',
        SaBeiZhu: '',
        CustomerId: ''
      },
      //添加附件
      AddAccessory: {
        AcsoryId: '',
        AcsoryIdNmae: '',
        AcsoryIdTime: '',
        AcsoryIdSize: '',
        AcsoryIdType: '',
        AcsoryIdUser: '',
        CustomerId: '',
      },
      //修改附件
      upAccessory: {
        AcsoryId: '',
        AcsoryIdNmae: '',
        AcsoryIdTime: '',
        AcsoryIdSize: '',
        AcsoryIdType: '',
        AcsoryIdUser: '',
        CustomerId: '',
      },
      country: [],//所在国家数组
      province: [],//省
      city: [], //市
      ClientType: [],//客户类型
      industry: [],//所属行业
    }
  },
  methods: {
    AddCustomer () {//添加基本信息
      if (this.CustomerData.CustId == '') {
        alert('客户编号不能为空')
        return;
      }
      if (this.CustomerData.CustName == '') {
        alert('客户名称不能为空')
        return;
      }
      if (this.CustomerData.CustAddress == '') {
        alert('公司地址不能为空')
        return;
      }
      this.$http({
        url: 'CustInfo/PostCustomer',
        method: 'post',
        data: this.CustomerData
      })

        .then(res => {
          if (res.data > 0) {
            this.$message.success('添加成功')
          }
        })
    },
    AddPersons () {//添加甲方负责人

      if (this.AddPerson.PersonPhone == '') {
        alert('电话不能为空');
        return;
      }
      var P = /^1[3-9]\d{9}$/;
      if (!P.test(this.AddPerson.PersonPhone)) {
        alert('电话格式不正确')
        return;
      }


      if (this.AddPerson.PersonEmail == '') {
        alert('邮箱不能为空');
        return;
      }
      var E = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
      if (!E.test(this.AddPerson.PersonEmail)) {
        alert('邮箱格式不正确');
        return;
      }
      this.dialogVisible = false
      this.$http({
        url: 'CustInfo/PostPerson',
        method: 'post',
        data: this.AddPerson
      })
        .then(res => {
          if (res.data > 0) {
            this.$message.success('添加成功')
            this.showPersons();
          }
        })
    },
    showPersons () {//显示甲方负责人
      this.$http({
        url: 'CustInfo/GetPerson',
        method: 'get',

      })
        .then(res => {
          this.PersonData = res.data
        })
    },

    editPersons (row) {//反填甲方负责人
      this.dialogVisibleEdit = true
      this.$http({
        url: 'CustInfo/GetPersonFT',
        method: 'get',
        params: {
          id: row.PersonId
        }
      })
        .then(res => {
          this.AddPerson1 = res.data
        })
    },
    updatePersons () {//修改甲方负责人
      this.dialogVisibleEdit = false;
      this.$http({
        url: 'CustInfo/PutPerson',
        method: 'put',
        data: this.AddPerson1
      })
        .then(res => {
          if (res.data > 0) {
            this.$message.success('修改成功');
            this.showPersons();
            return;
          }
        })
    },
    deletePersons (id) {//删除甲方负责人
      if (confirm('确定删除吗？')) {
        this.$http({
          url: 'CustInfo/DeletePerson',
          method: 'delete',
          params: {
            id: id
          }
        })
          .then(res => {
            if (res.data > 0) {
              this.$message.success('删除成功');
              this.showPersons();
              return;
            }
          })
      }

    },
    showAddress1 () {//国家
      this.$http({
        url: 'CustInfo/GetAddress1',
        method: 'get',
      })
        .then(res => {
          this.country = res.data
          this.showAddress2(res.data.PersonId)
        })

    },
    showAddress2 () {//省
      this.$http({
        url: 'CustInfo/GetAddress2',
        method: 'get',
        params: {
          id: this.ExtendedData.EdCountryId1
        }
      })
        .then(res => {
          this.province = res.data
        })
    },
    showAddress3 () {//市
      this.$http({
        url: 'CustInfo/GetAddress2',
        method: 'get',
        params: {
          id: this.ExtendedData.EdCountryId2
        }
      })
        .then(res => {
          this.city = res.data
        })
    },
    showTypes () {//客户类型
      this.$http({
        url: 'CustInfo/GetTypes',
        method: 'get',
      })
        .then(res => {
          this.ClientType = res.data
        })
    },
    showIndustry () {//所属行业
      this.$http({
        url: 'CustInfo/GetIndustry',
        method: 'get',
      })
        .then(res => {
          this.industry = res.data
        })
    },

    AddExtended () {//添加扩展信息
      this.$http({
        url: 'CustInfo/PostExtended',
        method: 'post',
        data: this.ExtendedData
      })
        .then(res => {
          if (res.data > 0) {
            this.$message.success('添加成功')
            return;
          }
        })
    },
    AddSatisfactions () {//添加满意度
      this.dialogVisibles = false
      this.$http({
        url: 'CustInfo/PostSatisfaction',
        method: 'post',
        data: this.AddSatisfaction
      })
        .then(res => {
          if (res.data > 0) {
            this.$message.success('添加成功')
            this.showSatisfactions();
            return;
          }
        })
    },
    showSatisfactions () {//显示客户满意度
      this.$http({
        url: 'CustInfo/GetSatisfaction',
        method: 'get',

      })
        .then(res => {
          this.SatisfactionData = res.data
        })
    },
    editSatisfactions (row) {//反填客户满意度
      this.dialogVisibles1 = true
      this.$http({
        url: 'CustInfo/GetSatisfactionFT',
        method: 'get',
        params: {
          id: row.SaId
        }
      })
        .then(res => {
          this.UpSatisfaction = res.data
        })
    },
    updateSatisfactions () {//修改客户满意度
      this.dialogVisibles1 = false;
      this.$http({
        url: 'CustInfo/PutSatisfaction',
        method: 'put',
        data: this.UpSatisfaction
      })
        .then(res => {
          if (res.data > 0) {
            this.$message.success('修改成功');
            this.showSatisfactions();
            return;
          }
        })
    },
    deleteSatisfactions (id) {//删除客户满意度
      if (confirm('确定删除吗？')) {
        this.$http({
          url: 'CustInfo/DeleteSatisfaction',
          method: 'delete',
          params: {
            id: id
          }
        })
          .then(res => {
            if (res.data > 0) {
              this.$message.success('删除成功');
              this.showSatisfactions();
              return;
            }
          })
      }

    },
    showAccessorys () {//显示附件
      this.$http({
        url: 'CustInfo/GetAccessory',
        method: 'get',

      })
        .then(res => {
          this.AccessoryData = res.data
        })
    },
    editAccessorys (row) {//反填附件
      this.dialogVisibless2 = true
      this.$http({
        url: 'CustInfo/GetAccessoryFT',
        method: 'get',
        params: {
          id: row.AcsoryId
        }
      })
        .then(res => {
          this.upAccessory = res.data

        })
    },
    AddAccessorys () {//添加附件
      this.dialogVisibless = false
      this.$http({
        url: 'CustInfo/PostAccessory',
        method: 'post',
        data: this.AddAccessory
      })
        .then(res => {
          if (res.data > 0) {
            this.$message.success('添加成功')
            this.showAccessorys();
            return;
          }
        })
    },
    updateAccessorys () {//修改附件
      this.dialogVisibless2 = false;
      this.$http({
        url: 'CustInfo/PutAccessory',
        method: 'put',
        data: this.upAccessory
      })
        .then(res => {
          if (res.data > 0) {
            this.$message.success('修改成功');
            this.showAccessorys();
            return;
          }
        })
    },
    deleteAccessorys (id) {//删除附件
      if (confirm('确定删除吗？')) {
        this.$http({
          url: 'CustInfo/DeleteAccessory',
          method: 'delete',
          params: {
            id: id
          }
        })
          .then(res => {
            if (res.data > 0) {
              this.$message.success('删除成功');
              this.showAccessorys();
              return;
            }
          })
      }

    },

  },
  created () {
    this.showPersons();
    this.showAddress1();
    this.showTypes();
    this.showIndustry();
    this.showSatisfactions();
    this.showAccessorys();
  }
}
</script>